﻿
/**
* 命名空间: Game.TDBehaviorTree
*
* 功 能： 行为节点工厂
* 类 名： TDBehaviorBT
*
* Ver 变更日期 负责人 变更内容
* ───────────────────────────────────
* V0.01 2019/12/11 18:59:59  
*/




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Game.TDBehaviorTree
{
    public static class TDBehaviorBT
    {
        public static NodeBase GetNode(NodeType type,int leafType)
        {

            NodeBase _node = null;
            switch (type)
            {
                case NodeType.Select:    // 选择节点
                    _node = new NodeSelect();
                    break;
                case NodeType.Sequence:  // 顺序节点
                    _node = new NodeSequence();
                    break;
                case NodeType.Random:    // 随机节点
                    _node = new NodeRandom();
                    break;
                case NodeType.Parallel:  // 并行节点
                    _node = new NodeParallel();
                    break;
                case NodeType.Decorator: // 修饰节点
                    _node = new NodeDecorate();
                    break;
                case NodeType.Action:
                    _node = GetLeafActionNode(leafType);
                    break;
                case NodeType.Condition:
                    _node = GetLeafActionNode(leafType);
                    break;
               
            }

            return _node;


        }

        private static NodeBase GetLeafActionNode(int leafType)
        {
            NodeBase _node = null;
            switch ((ActionNodeType)leafType)
            {
                case ActionNodeType.Log:
                    _node = new NodeLog();
                    break;
                case ActionNodeType.WaitTime:
                    _node = new NodeWait();
                    break;
                case ActionNodeType.PlayParticle:
                    _node = new NodePlayParticle();
                    break;
                case ActionNodeType.PlayAnim:
                    _node = new NodePlayAnim();
                    break;
                default:
                    break;
            }
           
            return _node;
        }

    }

    
}
